package com.jeeplus.core.DataSourceConfig;    /**
 * @title: DataSourceContextHolder
 * @projectName JeePlus
 * @description: TODO
 * @author Administrator
 * @date 2019/11/223:58
 */

public class DataSourceContextHolder {
    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

    public static void setDbType(String dbType) {
        contextHolder.set(dbType);
    }

    public static String getDbType() {
        return ((String) contextHolder.get());
    }
    //这个方法必不可少 否则切换数据库的时候有缓存现在
    public static void clearDbType() {
        contextHolder.remove();
    }
}
